/*
 * =====================================================================================
 *
 *       Filename:  NbtPacket.h
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  2012年02月14日 16时37分14秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Regan (), lcqhigh@gmail.com
 *        Company:  
 *
 * =====================================================================================
 */
#ifndef NBT_PACKET
#define NBT_PACKET

class NbtPacket
{
    NbtPacket(char *buf, int buflen);
    ~NbtPacket();

    //获取与设置包的类型
    bool isRequestType();
    bool isResponceType();
    //void setTypeToRequest();
    //void setTypeToResponce();

    void setHeaderLine(uint16_t id, unsigned char pcode, 
            unsigned char nmflag, unsigned char recode); 
            

    uint16_t transId();
    //void setTransId(int32_t id);

    unsigned char pcode(); 
    //void setPCode(unsigned char pcode);

    int resourceCount(uint16_t& qdcout, uint16_t& acount,
            uint16_t& nscount, uint16_t& arcount);
    void setResourceCount(uint16_t qdcout, uint16_t acount,
            uint16_t nscount, uint16_t arcount);

    unsigned char NM_Flags();
    //void setNM_Flags(unsigned char flag);

    unsigned char returnCode();

    char *name();
    void setName(char *name, int len);

    unsigned char NB_Flags();
    void setNB_Flags(unsigned char flag);
private:
    char *buf_;
    int  buflen_;
};


#endif
